package rubik;

import java.util.HashSet;

public class SudokuCube extends Cube {
	
	public SudokuCube()
	{
		this._cube = new Object[SIZE][SIZE][SIZE];
		this._copyCube = new Object[SIZE][SIZE][SIZE];
		int c = 1;

		for (int i = 1; i > -2; i--) {
			for (int j = -1; j < 2; j++) {
				for (EFace eface : EFace.values()) {
					this.setInFace(eface, j, i,c);
				}
				c++;
			}
		}
		this.save();
	}
	
	public int countConflicts()
	{
		HashSet<Integer> s = new HashSet<Integer>();
		int conflicts = 0;
		for (EFace eface : EFace.values())
		{
			for (int i = -1; i < 2; i++) {
				for (int j = -1; j < 2; j++) {
					s.add((Integer)this.getFromFace(eface, i, j));
				}
			}
			conflicts += Cube.ORIG_SIZE*Cube.ORIG_SIZE - s.size();
			s.clear();
		}
		return conflicts;
	}
	
}
